package com.xmxsuperstar.http;

import java.net.URL;

import net.love5z.common.utils.URLUtils;

public class TTURLUtils {

	public static HttpQueryParams getQueryParams(URL url) {
		HttpQueryParams res = new HttpQueryParams();
		String queryString = url.getQuery();
		if (queryString != null) {
			String[] params = queryString.split("&");
			for (String param : params) {
				String[] keyvalue = param.split("=");
				String key = URLUtils.urlDecode(keyvalue[0]);
				String value = URLUtils.urlDecode(keyvalue[1]);
				res.add(key, value);
			}
		}

		return res;
	}

}
